/**
 * 登录或注册表单模型
 */
interface FormModel {
    username: string;
    password: string;
    // 注册时使用
    confirmPassword?: string;
}

/**
 * 登录响应
 */
interface LoginRes {
    code: number;
    message: string;
    data: {
        username: string;
        token: string;
    };
}

/**
 * 注册响应
 */
interface RegisterRes {
    code: number;
    message: string;
    data: {
        username: string;
        token: string;
    };
}

/**
 * 用户信息
 */
interface UserInfo {
    id: number | null;
    username: string;
    phone: string;
    email: string;
    sex: Sex;
    /**
     * 个人简介
     */
    introduction: string;
    nickname: string;
    avatar: string;
    mediaVerifyType: MediaVerifyType;
    realNameStatus: RealNameStatus;
    createdTime: string;
}

/**
 * 获取用户信息响应
 */
interface getUserInfoRes {
    code: number;
    message: string;
    data: UserInfo;
}

/**
 * 更新头像响应，data 为头像地址
 */
interface updateAvatarRes {
    code: number;
    message: string;
    data: string;
}

/**
 * 更新用户信息请求
 */
interface UpdateUserInfoReq {
    username?: string;
    phone?: string;
    email?: string;
    sex?: Sex;
    /**
     * 自我介绍
     */
    introduction?: string;
}

/**
 * 性别
 * <ul>
 *     <li>0: 未知</li>
 *     <li>1: 男</li>
 *     <li>2: 女</li>
 * </ul>
 */
enum Sex {
    Unknown = 0,
    Male = 1,
    Female = 2
}

/**
 * 实名认证状态
 * <ul>
 *     <li>0: 未认证</li>
 *     <li>1: 已认证</li>
 *     <li>2: 待审核</li>
 *     <li>3: 认证失败</li>
 * </ul>
 */
enum RealNameStatus {
    Unverified = 0,
    Verified = 1,
    Pending = 2,
    VerificationFailed = 3
}

/**
 * 媒体认证类型
 * <ul>
 *     <li>0: 未认证</li>
 *     <li>1: 个人认证</li>
 *     <li>2: 媒体认证</li>
 * </ul>
 */
enum MediaVerifyType {
    Unverified = 0,
    PersonalVerified = 1,
    MediaVerified = 2
}

export type{
    FormModel,
    LoginRes,
    RegisterRes,
    UserInfo,
    getUserInfoRes,
    updateAvatarRes,
    UpdateUserInfoReq,
}
export {
    MediaVerifyType,
    RealNameStatus,
    Sex
}
